package BlackJack
{
	import BlackJack.BlackJackMediator;
	import BlackJack.Control.LobbyCommand;
	import BlackJack.Control.TableCommand;
	import BlackJack.Model.Events.LobbyEvent;
	import BlackJack.Model.Events.TableEvent;
	import BlackJack.View.Lobby;
	import BlackJack.View.LobbyMediator;
	import BlackJack.View.Table;
	import BlackJack.View.TableMediator;
	import flash.display.DisplayObjectContainer;
	import org.robotlegs.base.ContextEvent;
	import org.robotlegs.mvcs.Context;

	public class BlackJackContext extends Context
	{
		public function BlackJackContext(contextView:DisplayObjectContainer = null, autoStartup:Boolean = true)
		{
			super(contextView);
		}

		override public function startup():void
		{
			mediatorMap.mapView(Lobby, LobbyMediator);
			mediatorMap.mapView(Table, TableMediator);
			mediatorMap.mapView(BlackJackMain, BlackJackMediator);
			var type:String;
			for each (type in LobbyEvent.Events)
			{
				commandMap.mapEvent(type, LobbyCommand, LobbyEvent);
			}
			for each (type in TableEvent.Events)
			{
				commandMap.mapEvent(type, TableCommand, TableEvent);
			}
		}
	}
}
